/**
 * Copyright 2011, Under-Ground Studio.
 *  
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  
 *      http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.edu.zju.vlis.aus.bean;

/**
 * Instance of this class represents an application usage record. One record
 * includes packageName, useCount, useTime and lastUse fields.
 * 
 * @author ymsong (songyuming1985@gmail.com)
 * 2011-7-19
 */
public class UsageRecord {
	// app name
	private String appName;
	// app package name
	private String packageName;
	// use count
	private int useCount;
	// use time in seconds
	private int useTime;
	// last use time, in milliseconds since 1970-1-1 00:00:00.
	private long lastUse;
	// is statistic or not
	private boolean isStatistic;
	
	/**
	 * Default constructor.
	 */
	public UsageRecord() {

	}
	
	/**
	 * Constructor for convenience.
	 * @param packageName
	 * @param useCount
	 * @param useTime
	 * @param lastUse
	 */
	public UsageRecord(String packageName, int useCount , int useTime, long lastUse) {
		this.packageName = packageName;
		this.useCount = useCount;
		this.useTime = useTime;
		this.lastUse = lastUse;
	}


	/**
	 * @return the packageName
	 */
	public String getPackageName() {
		return packageName;
	}

	/**
	 * @param packageName
	 *            the packageName to set
	 */
	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	/**
	 * @return the useCount
	 */
	public int getUseCount() {
		return useCount;
	}

	/**
	 * @param useCount
	 *            the useCount to set
	 */
	public void setUseCount(int useCount) {
		this.useCount = useCount;
	}

	/**
	 * @return the useTime
	 */
	public int getUseTime() {
		return useTime;
	}

	/**
	 * @param useTime
	 *            the useTime to set
	 */
	public void setUseTime(int useTime) {
		this.useTime = useTime;
	}

	/**
	 * @return the lastUse
	 */
	public long getLastUse() {
		return lastUse;
	}

	/**
	 * @param lastUse
	 *            the lastUse to set
	 */
	public void setLastUse(long lastUse) {
		this.lastUse = lastUse;
	}
	
	/**
	 * @return the appName
	 */
	public String getAppName() {
		return appName;
	}

	/**
	 * @param appName
	 * 			the app name to set
	 */
	public void setAppName(String appName) {
		this.appName = appName;
	}

	/**
	 * @return the isStatistic
	 */
	public boolean isStatistic() {
		return isStatistic;
	}

	/**
	 * @param isStatistic
	 * 			the statistic to be set
	 */
	public void setStatistic(boolean isStatistic) {
		this.isStatistic = isStatistic;
	}

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("UsageRecord:[");
		sb.append("app=").append(packageName);
		sb.append(",count=").append(useCount);
		sb.append(",time=").append(useTime);
		sb.append(",lastuse=").append(lastUse);
		sb.append("]");
		return sb.toString();
	}

}
